// 定义 store
import { defineStore } from "pinia"
import {reactive} from 'vue'

export const useRememberMeStore = defineStore('rememberMe', () => {
    
    const rememberMe = reactive({
        username: '',
        password: ''
    })

    
    const setRememberMe = (newusername: string, newpassword: string) => {
        rememberMe.username = newusername
        rememberMe.password = newpassword
    }

    
    const removeRememberMe = () => {
        rememberMe.username = ''
        rememberMe.password = ''
    }

    return {
        rememberMe, setRememberMe, removeRememberMe
    }
}, 
{
    persist: true   // 持久化存储
}
)
